<div class="crumb-wrap">
    <div class="crumb-list"> <i class="icon-font"></i>
        <a href="<?=site_url()?>">首页</a>
        <span class="crumb-step">&gt;</span>
        <a href="<?=site_url('mess')?>">查看消息</a>
    </div>
</div>
<div class="result-wrap">
        <?php if(empty($_GET['s'])): ?>
        <div class="result-title">
            <div class="result-list">
                <a href="<?=site_url('mess/index?s=2')?>">查看历史消息</a>
            </div>
        </div>
        <?php else:?>
        <div class="result-title">
            <div class="result-list">
                <span>历史消息</span>
            </div>
        </div>
        <?php endif;?>
        <div class="result-content">
            <table class="result-tab" width="100%">
                <tr style="background: #eee">
                    <td>编号</td>
                    <td>状态</td>
                    <td>发信人</td>
                    <td width="60%">内容</td>
                    <td>时间</td>
                    <td>操作</td>
                </tr>
                <?php foreach($list as $k => $v):?>
                <tr>
                    <td><?=$v['id']?></td>
                    <?php if($v['status'] == 1):?>
                        <td style="color:red">未读</td>
                    <?php else:?>
                        <td>已读</td>
                    <?php endif;?>

                    <?php if($v['sending'] == 1):?>
                        <td style="color:red">系统消息</td>
                    <?php else:?>
                        <td>用户消息</td>
                    <?php endif;?>
                    <td><?=$v['content']?></td>
                    <td><?=date('Y-m-d H:i:s',$v['create_time'])?></td>
                    <td>
                        <a href="javascript:;" onclick="delete_mess(<?=$v['id']?>)">删除</a>
                    </td>
                </tr>
                <?php endforeach;?>

                <?php if(empty($list)):?>
                    <tr>
                        <td colspan="6">没有消息记录</td>
                    </tr>
                <?php endif;?>
            </table>
            <div class="list-page"><?=$page?></div>
        </div>
</div>

<script type="text/javascript">

    function delete_mess(mid){
        layer.confirm('删除之后不可恢复，是否确定？', {
            icon:0,
            btn: ['确定','取消'] //按钮
        }, function(){
            $.post("<?=site_url('mess/delete')?>",{mid:mid},function(data){
                if(data == 1){
                    layer.alert("操作成功！",{
                        icon:1,
                    },function(){
                        location.reload();
                    });
                }else{
                    layer.alert(data,{
                        icon:2,
                    });
                }
            });
        });
    }
</script>